﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Fluent="clr-namespace:Fluent" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
  <ControlTemplate x:Key="BackstageToggleButtonControlTemplate" TargetType="{x:Type Fluent:BackstageButton}">
    <Border x:Name="border2" Width="56" Height="22" CornerRadius="2,2,0,0" Background="{TemplateBinding Background}">
      <Border x:Name="border1" BorderThickness="1,1,1,0" CornerRadius="2,2,0,0">
      	<Border.BorderBrush>
      		<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
      			<GradientStop Color="#997C7C7C" Offset="0"/>
      			<GradientStop Color="#7F848484" Offset="1"/>
      		</LinearGradientBrush>
      	</Border.BorderBrush>
        <Border x:Name="border" BorderThickness="1,1,1,0" CornerRadius="1,1,0,0">
        	<Border.BorderBrush>
        		<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
        			<GradientStop Color="#72FFFFFF" Offset="0"/>
        			<GradientStop Color="#4CFFFFFF" Offset="1"/>
        		</LinearGradientBrush>
        	</Border.BorderBrush>
          <Border.Background>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
              <GradientStop Color="#3FFFFFFF" Offset="0"/>
              <GradientStop Offset="1" Color="#3FFFFFFF"/>
              <GradientStop Offset="0.5"/>
            </LinearGradientBrush>
          </Border.Background>
          <Grid>
            <Rectangle x:Name="rectangle_Copy" StrokeThickness="0">
          		<Rectangle.Fill>
          			<RadialGradientBrush Center="0.5,0.0" GradientOrigin="0.5,0.0" RadiusX="0.501" RadiusY="0.319">
          				<GradientStop Color="#59FFFFFF"/>
          				<GradientStop Offset="1"/>
          			</RadialGradientBrush>
          		</Rectangle.Fill>
          	</Rectangle>
          	<Rectangle x:Name="rectangle" StrokeThickness="0">
          		<Rectangle.Fill>
          			<RadialGradientBrush Center="0.5,1.001" GradientOrigin="0.5,1.001" RadiusX="0.496" RadiusY="0.554">
          				<GradientStop Color="#66FFFFFF" Offset="0.018"/>
          				<GradientStop Offset="1"/>
          			</RadialGradientBrush>
          		</Rectangle.Fill>
          	</Rectangle>
          	<TextBlock Margin="2,0,2,2" Text="{TemplateBinding Text}" TextWrapping="Wrap" d:LayoutOverrides="Width, Height" HorizontalAlignment="Center" VerticalAlignment="Center"/>
          </Grid>
        </Border>
      </Border>
    </Border>
    <ControlTemplate.Triggers>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True"/>
        </MultiTrigger.Conditions>
      	<Setter Property="BorderBrush" TargetName="border1">
      		<Setter.Value>
      			<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
      				<GradientStop Color="#A07C7C7C" Offset="0"/>
      				<GradientStop Color="#84848484" Offset="1"/>
      			</LinearGradientBrush>
      		</Setter.Value>
      	</Setter>
      	<Setter Property="Background" TargetName="border">
      		<Setter.Value>
      			<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
      				<GradientStop Color="#4CFFFFFF" Offset="0"/>
      				<GradientStop Color="#25FFFFFF" Offset="1"/>
      				<GradientStop Offset="0.5" Color="#19FFFFFF"/>
      			</LinearGradientBrush>
      		</Setter.Value>
      	</Setter>
      	<Setter Property="BorderBrush" TargetName="border">
      		<Setter.Value>
      			<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
      				<GradientStop Color="#7FFFFFFF" Offset="0"/>
      				<GradientStop Color="#59FFFFFF" Offset="1"/>
      			</LinearGradientBrush>
      		</Setter.Value>
      	</Setter>
      	<Setter Property="Fill" TargetName="rectangle_Copy">
      		<Setter.Value>
      			<RadialGradientBrush Center="0.5,0" GradientOrigin="0.5,0" RadiusX="0.501" RadiusY="0.319">
      				<GradientStop Color="#66FFFFFF"/>
      				<GradientStop Offset="1"/>
      			</RadialGradientBrush>
      		</Setter.Value>
      	</Setter>
      	<Setter Property="Fill" TargetName="rectangle">
      		<Setter.Value>
      			<RadialGradientBrush Center="0.5,1.001" GradientOrigin="0.5,1.001" RadiusX="0.496" RadiusY="0.554">
      				<GradientStop Color="#7FFFFFFF" Offset="0.018"/>
      				<GradientStop Offset="1"/>
      			</RadialGradientBrush>
      		</Setter.Value>
      	</Setter>
      </MultiTrigger>
      <Trigger Property="IsOpen" Value="True">
      	<Setter Property="Visibility" TargetName="rectangle" Value="Collapsed"/>
      	<Setter Property="Visibility" TargetName="rectangle_Copy" Value="Collapsed"/>
      	<Setter Property="BorderBrush" TargetName="border1">
      		<Setter.Value>
      			<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
      				<GradientStop Color="#99A1A1A1" Offset="0"/>
      				<GradientStop Color="#7F9A9A9A" Offset="1"/>
      			</LinearGradientBrush>
      		</Setter.Value>
      	</Setter>
      	<Setter Property="BorderBrush" TargetName="border">
      		<Setter.Value>
      			<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
      				<GradientStop Color="#4CFFFFFF" Offset="0"/>
      				<GradientStop Color="#72FFFFFF" Offset="1"/>
      			</LinearGradientBrush>
      		</Setter.Value>
      	</Setter>
      	<Setter Property="Background" TargetName="border">
      		<Setter.Value>
      			<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
      				<GradientStop Color="#19FFFFFF" Offset="0"/>
      				<GradientStop Color="#66FFFFFF" Offset="1"/>
      				<GradientStop Offset="0.5" Color="#3FFFFFFF"/>
      			</LinearGradientBrush>
      		</Setter.Value>
      	</Setter>
      </Trigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsMouseOver" Value="True" SourceName="border2"/>
          <Condition Property="IsOpen" Value="True"/>
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" TargetName="rectangle" Value="Collapsed"/>
      	<Setter Property="Visibility" TargetName="rectangle_Copy" Value="Collapsed"/>
      	<Setter Property="BorderBrush" TargetName="border1">
      		<Setter.Value>
      			<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
      				<GradientStop Color="#A0A1A1A1" Offset="0"/>
      				<GradientStop Color="#879A9A9A" Offset="1"/>
      			</LinearGradientBrush>
      		</Setter.Value>
      	</Setter>
      	<Setter Property="BorderBrush" TargetName="border">
      		<Setter.Value>
      			<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
      				<GradientStop Color="#59FFFFFF" Offset="0"/>
      				<GradientStop Color="#7FFFFFFF" Offset="1"/>
      			</LinearGradientBrush>
      		</Setter.Value>
      	</Setter>
      	<Setter Property="Background" TargetName="border">
      		<Setter.Value>
      			<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
      				<GradientStop Color="#26FFFFFF" Offset="0"/>
      				<GradientStop Color="#7FFFFFFF" Offset="1"/>
      				<GradientStop Offset="0.5" Color="#4CFFFFFF"/>
      			</LinearGradientBrush>
      		</Setter.Value>
      	</Setter>
      </MultiTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>

  <Style x:Key="BackstageToggleButtonStyle" TargetType="{x:Type Fluent:BackstageButton}">
    <Setter Property="Template" Value="{StaticResource BackstageToggleButtonControlTemplate}"/>
    <Setter Property="Width" Value="56"/>
    <Setter Property="Height" Value="22"/>
    <Setter Property="Background" Value="Blue"/>
    <Setter Property="FontFamily" Value="{DynamicResource DefaultFontFamily}"/>
    <Setter Property="FontSize" Value="{DynamicResource DefaultFontSize}"/>
    <Setter Property="Foreground" Value="White"/>
  </Style>
  

  <ControlTemplate x:Key="RibbonControlTemplate" TargetType="{x:Type Fluent:Ribbon}">
      <ControlTemplate.Resources>
      </ControlTemplate.Resources>
    	<Grid x:Name="PART_LayoutRoot" Width="Auto" Height="Auto">
        <Grid.ContextMenu>
          <Fluent:ContextMenu x:Name="PART_RibbonContextMenu">
            <Fluent:MenuItem x:Name="PART_AddToQuickAccessMenuItem" x:Uid="AddToQuickAccessString" Text="{Binding Source={x:Static Fluent:Ribbon.Localization}, Path=RibbonContextMenuAddItem, Mode=OneWay}"/>
            <Fluent:MenuItem x:Name="PART_AddGroupToQuickAccessMenuItem" x:Uid="AddGroupToQuickAccessString" Text="{Binding Source={x:Static Fluent:Ribbon.Localization}, Path=RibbonContextMenuAddGroup, Mode=OneWay}"/>
            <Fluent:MenuItem x:Name="PART_AddMenuToQuickAccessMenuItem" x:Uid="AddMenuToQuickAccessString" Text="{Binding Source={x:Static Fluent:Ribbon.Localization}, Path=RibbonContextMenuAddMenu, Mode=OneWay}"/>
            <Fluent:MenuItem x:Name="PART_AddGalleryToQuickAccessMenuItem" x:Uid="AddGalleryToQuickAccessString" Text="{Binding Source={x:Static Fluent:Ribbon.Localization}, Path=RibbonContextMenuAddGallery, Mode=OneWay}"/>
            <Fluent:MenuItem x:Name="PART_RemoveFromQuickAccessMenuItem" x:Uid="RemoveFromQuickAccessString" Text="{Binding Source={x:Static Fluent:Ribbon.Localization}, Path=RibbonContextMenuRemoveItem, Mode=OneWay}"/>
            <Separator Style="{DynamicResource MenuSeparatorStyle}" x:Name="topMenuSeparator"/>
            <Fluent:MenuItem x:Name="PART_CustomizeQuickAccessToolbarMenuItem" x:Uid="CustomizeQuickAccessToolbarString" Text="{Binding Source={x:Static Fluent:Ribbon.Localization}, Path=RibbonContextMenuCustomizeQuickAccessToolBar, Mode=OneWay}"/>
            <Fluent:MenuItem x:Name="PART_ShowQuickAccessToolbarBelowTheRibbonMenuItem" x:Uid="ShowQuickAccessToolbarBelowTheRibbonString" Text="{Binding Source={x:Static Fluent:Ribbon.Localization}, Path=RibbonContextMenuShowBelow, Mode=OneWay}"/>
            <Fluent:MenuItem x:Name="PART_ShowQuickAccessToolbarAboveTheRibbonMenuItem" x:Uid="ShowQuickAccessToolbarAboveTheRibbonString" Text="{Binding Source={x:Static Fluent:Ribbon.Localization}, Path=RibbonContextMenuShowAbove, Mode=OneWay}"/>
            <Separator x:Name="separator" Style="{DynamicResource MenuSeparatorStyle}"/>
            <Fluent:MenuItem x:Name="PART_CustomizeTheRibbonMenuItem" x:Uid="CustomizeTheRibbonString" Text="{Binding Source={x:Static Fluent:Ribbon.Localization}, Path=RibbonContextMenuCustomizeRibbon, Mode=OneWay}"/>
            <Fluent:MenuItem x:Name="PART_MinimizeTheRibbonMenuItem" x:Uid="MinimizeTheRibbonString" Text="{Binding Source={x:Static Fluent:Ribbon.Localization}, Path=RibbonContextMenuMinimizeRibbon, Mode=OneWay}" IsChecked="{Binding Path=IsMinimized, RelativeSource={RelativeSource TemplatedParent}, Mode=Default}"/>
          </Fluent:ContextMenu>          
        </Grid.ContextMenu>
    		<Grid.RowDefinitions>
    			<RowDefinition Height="0.748*"/>
    			<RowDefinition Height="0.252*"/>
    		</Grid.RowDefinitions>
    		<Fluent:RibbonTitleBar x:Name="PART_RibbonTitleBar" Height="25" Style="{DynamicResource RibbonTitleBarStyle}" Margin="20,0,113,0" VerticalAlignment="Top">
				<Fluent:RibbonTitleBar.Header>
					<Grid>
    			<Rectangle x:Name="rectangle" Fill="#7FFFFFFF" Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,2,0,3" Width="{Binding ActualWidth, ElementName=PART_Title, Mode=Default}" Height="{Binding ActualHeight, ElementName=PART_Title, Mode=Default}" RadiusX="2" RadiusY="2">
    				<Rectangle.Effect>
    					<BlurEffect Radius="10"/>
    				</Rectangle.Effect>
    			</Rectangle>
    			<TextBlock x:Name="PART_Title" Margin="4,0,4,0" VerticalAlignment="Center" d:LayoutOverrides="Width" HorizontalAlignment="Center" Text="{Binding Path=Title,RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" Foreground="Black" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis"/>
    		</Grid>
				</Fluent:RibbonTitleBar.Header>
    			
    		</Fluent:RibbonTitleBar>
    		<Fluent:RibbonTabControl Style="{DynamicResource RibbonTabControlStyle}" x:Name="PART_RibbonTabControl" Margin="0,25,0,0" Focusable="False"/>
    		<Fluent:BackstageButton x:Name="PART_BackstageButton" Margin="2,26,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Width="56" Height="22" Style="{StaticResource BackstageToggleButtonStyle}" Text="{Binding Source={x:Static Fluent:Ribbon.Localization}, Path=BackstageButtonText, Mode=OneWay}" Size="Small" Background="{TemplateBinding BackstageBrush}" 
                                Fluent:KeyTip.Keys="{Binding Source={x:Static Fluent:Ribbon.Localization}, Path=BackstageButtonKeyTip, Mode=OneWay}"/>
    		<Border x:Name="border" Margin="0" BorderBrush="{DynamicResource QuickAccessToolBarOutterBorderBrush}" BorderThickness="0,1" Grid.Row="1" Height="26">
    			<Border BorderBrush="{DynamicResource QuickAccessToolBarInnerBorderBrush}" BorderThickness="0,1" Background="{DynamicResource QuickAccessToolBarInnerBackgroundBrush}">
    				<ContentControl x:Name="contentControl" HorizontalAlignment="Left">
    					<Fluent:QuickAccessToolBar x:Name="PART_QuickAccessToolBar" Style="{DynamicResource QuickAccessToolbarStyle}" ShowAboveRibbon="{Binding ShowQuickAccessToolBarAboveRibbon, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" HorizontalAlignment="Left"/>
    				</ContentControl>
    			</Border>
    		</Border>
			<Grid x:Name="grid" Margin="28,0,113,0" Height="30" IsHitTestVisible="False" VerticalAlignment="Top" Visibility="Collapsed" HorizontalAlignment="Left">
    			<Rectangle x:Name="rectangle5" Fill="#7FFFFFFF" Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="-4,5,-4,3" Width="{Binding ActualWidth, ElementName=PART_Title, Mode=Default}" Height="{Binding ActualHeight, ElementName=PART_Title, Mode=Default}" RadiusX="2" RadiusY="2">
    				<Rectangle.Effect>
    					<BlurEffect Radius="10"/>
    				</Rectangle.Effect>
    			</Rectangle>
    			<TextBlock x:Name="textBlock5" Margin="0,3,0,0" VerticalAlignment="Center" d:LayoutOverrides="Width" HorizontalAlignment="Left" Text="{Binding Path=Title,RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" Foreground="Black" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis"/>
    		</Grid>
    		
    	</Grid>
    	<ControlTemplate.Triggers>
		<Trigger Property="CanQuickAccessLocationChanging" Value="False">
  			<Setter Property="Visibility" TargetName="PART_ShowQuickAccessToolbarBelowTheRibbonMenuItem" Value="Collapsed"/>
  			<Setter Property="Visibility" TargetName="PART_ShowQuickAccessToolbarAboveTheRibbonMenuItem" Value="Collapsed"/>
  			<Setter Property="Visibility" TargetName="separator" Value="Collapsed"/>
  		</Trigger>
  		<Trigger Property="IsQuickAccessToolBarVisible" Value="False">
  			<Setter Property="Visibility" TargetName="border" Value="Collapsed"/>
  			<Setter Property="Visibility" TargetName="PART_QuickAccessToolBar" Value="Collapsed"/>
  			<Setter Property="Visibility" TargetName="PART_ShowQuickAccessToolbarBelowTheRibbonMenuItem" Value="Collapsed"/>
  			<Setter Property="Visibility" TargetName="PART_ShowQuickAccessToolbarAboveTheRibbonMenuItem" Value="Collapsed"/>
  			<Setter Property="Visibility" TargetName="PART_RemoveFromQuickAccessMenuItem" Value="Collapsed"/>
  			<Setter Property="Visibility" TargetName="PART_AddGalleryToQuickAccessMenuItem" Value="Collapsed"/>
  			<Setter Property="Visibility" TargetName="PART_AddMenuToQuickAccessMenuItem" Value="Collapsed"/>
  			<Setter Property="Visibility" TargetName="PART_AddGroupToQuickAccessMenuItem" Value="Collapsed"/>
  			<Setter Property="Visibility" TargetName="PART_AddToQuickAccessMenuItem" Value="Collapsed"/>
  			<Setter Property="Visibility" TargetName="separator" Value="Collapsed"/>
  			<Setter Property="Visibility" TargetName="topMenuSeparator" Value="Collapsed"/>
  		</Trigger>
  		<Trigger Property="IsCollapsed" Value="True">
  			<Setter Property="Visibility" TargetName="PART_RibbonTitleBar" Value="Collapsed"/>
  			<Setter Property="Visibility" TargetName="PART_RibbonTabControl" Value="Collapsed"/>
  			<Setter Property="Visibility" TargetName="PART_BackstageButton" Value="Collapsed"/>
  			<Setter Property="Visibility" TargetName="border" Value="Collapsed"/>
  			<Setter Property="Visibility" TargetName="grid" Value="Visible"/>
  			<Setter Property="Margin" TargetName="rectangle5" Value="0,5,0,3"/>
  			<Setter Property="Margin" TargetName="textBlock5" Value="4,3,4,0"/>
  			<Setter Property="Width" TargetName="rectangle5" Value="{Binding ActualWidth, ElementName=grid, Mode=Default}"/>
  		</Trigger>
  		<Trigger Property="ShowQuickAccessToolBarAboveRibbon" Value="True">    			
  			<Setter Property="Content" TargetName="contentControl" Value="{x:Null}"/>
  			<Setter Property="QuickAccessToolBar" TargetName="PART_RibbonTitleBar" Value="{Binding ElementName=PART_QuickAccessToolBar, Mode=OneWay}"/>
  			<Setter Property="Visibility" TargetName="border" Value="Collapsed"/>
  			<Setter Property="Margin" TargetName="PART_QuickAccessToolBar" Value="0,2,0,0"/>
  		</Trigger>
  		<MultiTrigger>
  			<MultiTrigger.Conditions>
  				<Condition Property="Visibility" Value="Collapsed" SourceName="PART_AddToQuickAccessMenuItem"/>
  				<Condition Property="Visibility" Value="Collapsed" SourceName="PART_AddGroupToQuickAccessMenuItem"/>
  				<Condition Property="Visibility" Value="Collapsed" SourceName="PART_AddMenuToQuickAccessMenuItem"/>
  				<Condition Property="Visibility" Value="Collapsed" SourceName="PART_AddGalleryToQuickAccessMenuItem"/>
  				<Condition Property="Visibility" Value="Collapsed" SourceName="PART_RemoveFromQuickAccessMenuItem"/>
  			</MultiTrigger.Conditions>
  			<Setter Property="Visibility" Value="Collapsed" TargetName="topMenuSeparator"/>
  		</MultiTrigger>
  		<Trigger Property="ShowQuickAccessToolBarAboveRibbon" Value="True">
  			<Setter Property="Visibility" TargetName="PART_ShowQuickAccessToolbarAboveTheRibbonMenuItem" Value="Collapsed"/>
  		</Trigger>
  		<Trigger Property="ShowQuickAccessToolBarAboveRibbon" Value="False">
  			<Setter Property="Visibility" TargetName="PART_ShowQuickAccessToolbarBelowTheRibbonMenuItem" Value="Collapsed"/>
  		</Trigger>
  		<Trigger Property="CanCustomizeQuickAccessToolBar" Value="False">
  			<Setter Property="Visibility" TargetName="PART_CustomizeQuickAccessToolbarMenuItem" Value="Collapsed"/>
  		</Trigger>
  		<Trigger Property="CanCustomizeRibbon" Value="False">
  			<Setter Property="Visibility" TargetName="PART_CustomizeTheRibbonMenuItem" Value="Collapsed"/>
  		</Trigger>
  	</ControlTemplate.Triggers>
    </ControlTemplate>

  <Style x:Key="RibbonStyle" TargetType="{x:Type Fluent:Ribbon}">
    <Setter Property="Foreground" Value="{DynamicResource DefaultFontBrush}"/>
    <Setter Property="FontFamily" Value="{DynamicResource DefaultFontFamily}"/>
    <Setter Property="FontSize" Value="{DynamicResource DefaultFontSize}"/>
    <Setter Property="Template" Value="{StaticResource RibbonControlTemplate}"/>
    <Setter Property="FocusVisualStyle" Value="{DynamicResource ControlStyleEmptyFocus}"/>
    <Setter Property="FocusManager.IsFocusScope" Value="True"/>
    <Setter Property="VerticalAlignment" Value="Top"/>
	<Setter Property="FocusVisualStyle" Value="{DynamicResource ControlStyleEmptyFocus}"/>
  </Style>
</ResourceDictionary>